<% content_for :page_title do %>
  <%= Spree.t(:products) %>
<% end %>

<% content_for :page_actions do %>
  <%= render_admin_partials(:products_actions_partials) %>
  <%= link_to_with_icon 'table-import', Spree.t(:import), spree.new_admin_import_path(type: 'Spree::Imports::Products'), class: 'btn btn-light', data: { action: 'drawer#open',turbo_frame: :drawer } if can?(:create, Spree::Import) %>
  <%= link_to_export_modal %>
  <%= link_to_with_icon 'plus', Spree.t(:new_product), new_object_url, class: 'btn btn-primary' if can?(:create, Spree::Product) %>
<% end %>

<%= render_admin_partials(:products_header_partials) %>

<div class="card-lg">
  <% if params[:frame_name].present? %>
    <%= turbo_frame_tag params[:frame_name], autoscroll: true, data: { autoscroll_block: :start, autoscroll_behavior: :smooth } do %>
      <%= render 'filters', frame_name: params[:frame_name] %>
      <%= render 'list' %>
    <% end %>
  <% else %>
    <%= turbo_frame_tag "products", autoscroll: true, data: { autoscroll_behavior: :smooth, turbo_action: 'advance' } do %>
      <%= render 'spree/admin/shared/export_modal', export_type: Spree::Exports::Products %>
      <%= render 'filters' %>
      <%= render 'list' %>
    <% end %>
  <% end %>
</div>

<p class="documentation-link-container">
  Learn more about
  <%= external_link_to 'managing products', 'https://spreecommerce.org/docs/user/manage-products' %>
</p>